import { _detail } from '../../common/companies'
const app = getApp()
const WxParse = require('../../libs/wxParse/wxParse.js')
Page({
  data: {
    id: '',
    banner: 'http://tianyue.1juke.cn/res/qiyegongxiang.png',
    detail: null
  },
  detail () {
    app.loading('加载中')
    _detail(this.data.id).then(res => {
      wx.hideLoading()
      this.data.detail = res.data.Share_Company
      let article = res.data.Share_Company.Content
      WxParse.wxParse('article', 'html', article, this, 0)
      this.setData({
        detail: this.data.detail
      })
    }).catch(err => {
      console.log(err)
      wx.hideLoading()
      wx.showModal({
        title: '对不起',
        content: '网络错误，请稍后再试',
        showCancel: false
      })
    })
  },
  onLoad(options) {
    this.data.id = options.id
    this.detail()
  },
  onReady() { },
  onShow() { },
  onShareAppMessage() {
    return app.shareInfo
  }
})